package A14;

import java.util.List;

public class Customer {
    private String name; // 姓名
    private String contact; // 联系电话
    private String deliveryAddress; // 邮寄地址
    private boolean active; // 是否激活
    private List<Order> orders; // 关联：0~*个订单

    public Customer(String name, String contact, String deliveryAddress, boolean active) {
        this.name = name;
        this.contact = contact;
        this.deliveryAddress = deliveryAddress;
        this.active = active;
    }

    // 创建订单
    public void createOrder(Order order) {
        if (orders == null) {
            throw new IllegalStateException("请先初始化orders集合！");
        }
        orders.add(order);
    }

    // getter/setter
    public String getName() {
        return name;
    }

    public String getContact() {
        return contact;
    }

    public String getDeliveryAddress() {
        return deliveryAddress;
    }

    public boolean isActive() {
        return active;
    }

    public List<Order> getOrders() {
        return orders;
    }

    public void setOrders(List<Order> orders) {
        this.orders = orders;
    }
}
